import { request } from "@/utils/request";
import { getCurrentOrganizationId } from '@/utils/util.js'
let userinfo = JSON.parse(sessionStorage.getItem('userInfo')),userId=null
if (userinfo) {
    userId = userinfo.loginName
}
const api = {
  getQisUrl:
    "/project/Windchill/servlet/rest/hzero/pmgt/project/getQisUrl",
  getCurrentMonthTaskRate:
    "/project/Windchill/servlet/rest/hzero/pmgt/project/getCurrentMonthTaskRate",
  getProjectIssueCloseCase:
    `/project/v1/${getCurrentOrganizationId()}/instrumentPanel/getProjectIssueCloseCase`,
  selectProjectApprovalCase:
    `/project/v1/${getCurrentOrganizationId()}/instrumentPanel/selectProjectApprovalCase/${userId}`,
  selectProjectCostClass:
    `/project/v1/${getCurrentOrganizationId()}/finance-caches/selectProjectCostClass`,
  selectProjectCostClassDetails:
    `/project/v1/${getCurrentOrganizationId()}/finance-caches/selectProjectCostClassDetails`,
  uploadSubjectsClassifyFile:
    `/project/v1/${getCurrentOrganizationId()}/finance-caches/uploadSubjectsClassifyFile`,
  conditionBean:
  `/project/v1/${getCurrentOrganizationId()}/plm-ecc-caches/conditionBean`,
  conditionList:
  `/project/v1/${getCurrentOrganizationId()}/plm-ecc-caches/conditionList`,
  primitiveList:
  `/project/v1/${getCurrentOrganizationId()}/plm-ecc-caches/primitiveList`,
  nameUrl:
    `/project/v1/${getCurrentOrganizationId()}/ikm-caches/nameUrl`
}
//获取QIS地址
export function getQisUrl(parameter) {
  return request({
      url: api.getQisUrl,
      method: 'post',
      data: parameter
  })
}
//项目仪表模块获取用户本月项目任务完成率
  export function getCurrentMonthTaskRate(parameter) {
    return request({
      url: api.getCurrentMonthTaskRate,
      method: 'post',
      data: parameter
    })
  }
  export function getProjectIssueCloseCase(parameter) {
    return request({
      url: `/project/v1/${getCurrentOrganizationId()}/instrumentPanel/getProjectIssueCloseCase`,
      method: 'post',
      data: parameter
    })
  }
  //规划项目立项情况
  export function selectProjectApprovalCase(parameter) {
    return request({
      url:  `/project/v1/${getCurrentOrganizationId()}/instrumentPanel/selectProjectApprovalCase/${userId}`,
      method: 'get',
      data: parameter
    })
  }
  //项目成本列表
export function selectProjectCostClass(parameter) {
  return request({
      url: `/project/v1/${getCurrentOrganizationId()}/finance-caches/selectProjectCostClass`,
      method: 'post',
      data: parameter
  })
}
  //项目成本列表
  export function selectProjectCostClassDetails(parameter) {
    return request({
        url: `/project/v1/${getCurrentOrganizationId()}/finance-caches/selectProjectCostClassDetails`,
        method: 'post',
        data: parameter
    })
  }
    //项目成本列表
export function uploadSubjectsClassifyFile(parameter) {
  return request({
      url: `/project/v1/${getCurrentOrganizationId()}/finance-caches/uploadSubjectsClassifyFile`,
      method: 'post',
      data: parameter
  })
}
//标准成本列表
export function conditionBean(parameter) {
  return request({
    url: `/project/v1/${getCurrentOrganizationId()}/plm-ecc-caches/conditionBean`,
    method: 'post',
    data: parameter
  })
}
//标准成本明细列表
export function conditionList(parameter) {
  return request({
    url: `/project/v1/${getCurrentOrganizationId()}/plm-ecc-caches/conditionList`,              
    method: 'post',
    data: parameter
  })
}
//标准成本默认列表
export function primitiveList(parameter) {
  return request({
    url: `/project/v1/${getCurrentOrganizationId()}/plm-ecc-caches/primitiveList`,
    method: 'post',
    data: parameter
  })
}
//ikm
export function nameUrl(parameter) {
  return request({
    url: `/project/v1/${getCurrentOrganizationId()}/ikm-caches/nameUrl`,
    method: 'post',
    data: parameter
  })
}